package it.polito.connectedcar.tcc;

import it.polito.connectedcar.tcc.zone.Token;

import java.net.InetSocketAddress;

/**
 * This class models a TrafficLight representation for a TCC. Each vehicles is
 * characterized by an unique internet address , an identifier and some
 * continuously changing information like current position, speed and direction
 * 
 * @author Nicola Aresta
 * 
 */
public class TCCVehicleAbstraction {

	private InetSocketAddress address;

	private double direction;
	private double utmXPos;
	private double utmYPos;
	private double speed;
	private Token vehicleId;

	private String currentLaneId;
	private int currentQuadrant;
	private Token belongingToken;
	private Token approachingToken;

	public InetSocketAddress getAddress() {
		return address;
	}

	public void setAddress(InetSocketAddress address) {
		this.address = address;
	}

	public int getCurrentQuadrant() {
		return currentQuadrant;
	}

	public void setCurrentQuadrant(int currentQuadrant) {
		this.currentQuadrant = currentQuadrant;
	}

	public double getCurrentDirection() {
		return direction;
	}

	public void setCurrentDirection(double currentDirection) {
		this.direction = currentDirection;
	}

	public Token getBelongingToken() {
		return belongingToken;
	}

	public void setBelongingToken(Token belongingToken) {
		this.belongingToken = belongingToken;
	}

	public double getUtmYPos() {
		return utmYPos;
	}

	public void setUtmYPos(double utmYPos) {
		this.utmYPos = utmYPos;
	}

	public double getUtmXPos() {
		return utmXPos;
	}

	public void setUtmXPos(double utmXPos) {
		this.utmXPos = utmXPos;
	}

	public double getSpeed() {
		return speed;
	}

	public void setSpeed(double speed) {
		this.speed = speed;
	}

	public String getCurrentLaneId() {
		return currentLaneId;
	}

	public void setCurrentLaneId(String currentLaneId) {
		this.currentLaneId = currentLaneId;
	}

	public Token getVehicleId() {
		return vehicleId;
	}

	public void setVehicleId(Token vehicleId) {
		this.vehicleId = vehicleId;
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof TCCVehicleAbstraction))
			return false;
		return getVehicleId().equals(((TCCVehicleAbstraction) obj).getVehicleId());
	}

	public void setApproachingToken(Token approachingToken) {
		this.approachingToken = approachingToken;
	}

	public Token getApproachingToken() {
		return this.approachingToken;
	}
}
